package com.ruoyi.system.xmlAbstract.interfaces.templateInterfaces.impl;

import com.ruoyi.system.xmlAbstract.XmlGenerateAbstract;
import com.ruoyi.system.xmlAbstract.impl.XmlBuild;
import com.ruoyi.system.xmlAbstract.interfaces.templateInterfaces.XmlTemplateInterface;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 查询账户明细
 * @author : anxinr
 * @date : 2023/1/18 9:57
 */
@Slf4j
@Scope("prototype")
@Component(value = "CQRA10XmlTemplate")
public class CQRA10XmlTemplate implements XmlTemplateInterface {
    @Override
    public XmlGenerateAbstract generateXmlTemplate() throws Exception {
        XmlBuild xmlBuild = new XmlBuild();
        xmlBuild.generateRootNode("ap");
        xmlBuild.generateChildNode("CCTransCode","CQRA10");

        xmlBuild.generateChildNode("CorpNo");
        xmlBuild.generateChildNode("ProductID","ICC");
        xmlBuild.generateChildNode("ChannelType","ERP");
        xmlBuild.generateChildNode("ReqId", "");
        xmlBuild.generateChildNode("OpNo");
        xmlBuild.generateChildNode("AuthNo");
        xmlBuild.generateChildNode("Sign");
        xmlBuild.generateChildNode("TransCode");
        xmlBuild.generateChildNode("ReqSeqNo","1412676336505458688");
        xmlBuild.generateChildNode("ReqDate",new SimpleDateFormat("yyyyMMdd").format(new Date()));
        xmlBuild.generateChildNode("ReqTime",new SimpleDateFormat("HHmmss").format(new Date()));

        xmlBuild.generateChildNode("Corp");
        xmlBuild.setCurrentNodeToChildNodeByNodeName("Corp");
        xmlBuild.generateChildNode("StartDate");
        xmlBuild.generateChildNode("EndDate");
        xmlBuild.changeCurrentNodeToParentNode();
        xmlBuild.generateChildNode("Channel");
        xmlBuild.setCurrentNodeToChildNodeByNodeName("Channel");
        xmlBuild.generateChildNode("LastJrnNo","0");
        xmlBuild.changeCurrentNodeToParentNode();
        xmlBuild.generateChildNode("Cmp");
        xmlBuild.setCurrentNodeToChildNodeByNodeName("Cmp");
        xmlBuild.generateChildNode("DbAccNo","049301040011772");
        xmlBuild.generateChildNode("DbProv","44");
        xmlBuild.generateChildNode("DbCur","01");
        xmlBuild.generateChildNode("StartTime",System.currentTimeMillis()+"");
        return xmlBuild;
    }
}
